package com.gmail.at.model;

import java.io.Serializable;
import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Version;
import javax.validation.constraints.Size;

import org.codehaus.jackson.annotate.JsonIgnore;
import org.hibernate.validator.constraints.NotEmpty;


/**
 * The persistent class for the station database table.
 * 
 */
@Entity
public class Station implements Serializable {
	private static final long serialVersionUID = 1L;

	@Id
	@GeneratedValue(strategy=GenerationType.TABLE)
	private int stationID;

	private String stationName;
	
	private int version;

	//bi-directional many-to-one association to Schedule
	@OneToMany(mappedBy="station1", cascade = CascadeType.ALL, orphanRemoval = true)
	private List<Schedule> schedules1;

	//bi-directional many-to-one association to Schedule
	@OneToMany(mappedBy="station2", cascade = CascadeType.ALL, orphanRemoval = true)
	private List<Schedule> schedules2;

	public Station() {
	}

	public int getStationID() {
		return this.stationID;
	}

	public void setStationID(int stationID) {
		this.stationID = stationID;
	}

	@NotEmpty(message="{validation.stationName.NotEmpty.message}")
	@Size(min=3, max=60, message="{validation.stationName.Size.message}")
	public String getStationName() {
		return this.stationName;
	}

	public void setStationName(String stationName) {
		this.stationName = stationName;
	}

	@JsonIgnore
	public List<Schedule> getSchedules1() {
		return this.schedules1;
	}

	public void setSchedules1(List<Schedule> schedules1) {
		this.schedules1 = schedules1;
	}

	@JsonIgnore
	public List<Schedule> getSchedules2() {
		return this.schedules2;
	}

	public void setSchedules2(List<Schedule> schedules2) {
		this.schedules2 = schedules2;
	}

	@Version
	public int getVersion() {
		return version;
	}

	@Version
	public void setVersion(int version) {
		this.version = version;
	}

}